import time

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.implicitly_wait(10)
driver.maximize_window()
#修改项目立项单据项目名称
def update():
    #进入地址
    driver.get('http://10.10.10.120:30205')
    #输入用户名、密码
    driver.find_element(By.ID,'username').send_keys('administrator')
    driver.find_element(By.ID,'password').send_keys('Gdjt@2021')
    driver.find_element(By.XPATH,'//button').click()
    time.sleep(5)
    #进入项目立项申请
    driver.find_element(By.XPATH,'//*[text()="项目立项管理"]').click()
    driver.find_element(By.XPATH, '//*[text()="立项申请"]').click()
    #点击修改
    driver.find_element(By.XPATH, '//*[text()="操作"]/.').click()
    time.sleep(3)
    driver.find_element(By.XPATH, '//*[text()="修改"]/.').click()
    time.sleep(3)
    #修改项目名称
    driver.find_element(By.XPATH,'//input[@placeholder="请输入"]').clear()
    driver.find_element(By.XPATH, '//input[@placeholder="请输入"]').send_keys('长春1号线、2号线改修项目')
    #保存
    driver.find_element(By.XPATH, '//*[text()="保存"]/..').click()
    driver.find_element(By.XPATH,'//button[@aria-label="Close"]').click()

if __name__ == '__main__':
    update()
    time.sleep(5)